package com.system.controller;

import com.system.pojo.Department;
import com.system.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * Created by 陈文杰 on 2022/6/9 8:49
 */
@Controller
public class DepartmentController {
    @Autowired
    DepartmentService departmentService;
    @RequestMapping("/toDepartment")
    public ModelAndView toDepartment(){
        ModelAndView modelAndView = new ModelAndView();
        List<Department> departments = departmentService.queryDeptAll();
        modelAndView.addObject("departments",departments);
        modelAndView.setViewName("dep");
        return modelAndView;
    }
}
